/**
 * Created by mooshroom on 2015/4/7.
 */
define('doc', function () {
    return doc = avalon.define({
        $id: "doc",

        apiID: "",

        Title: "",
        Memo: "",
        version: "",
        Request: {},
        demo: {},
        demoStr: "",
        Response: {},
        author: {},
        List: {},
        String: "",


        get: function (apiID) {
            if (home.apiURL !== "" && home.apiURL !== null) {

                apiURL = home.apiURL
            }
            doc.reset();
            $.call({
                type: "post",
                i: apiID,
                data: {doc: "1"},
                success: function (data) {
                    if (data.Title) {
                        doc.demoStr = JSON.stringify(data.demo);
                        var x;
                        for (x in data) {
                            doc[x] = data[x]
                        }


                    }
                    doc.apiID = apiID;
                }
            })

        },


        reset: function () {
            doc.Title = "";
            doc.Memo = "";
            doc.version = "";
            doc.Request = {};
            doc.demo = {};
            doc.demoStr = "";
            doc.Response = {};
            doc.author = {};

        }
    })
})